import Vue from 'vue'
import axios from 'axios'
const api = "/";

export const http = axios.create({
    baseURL: api,
})

http.defaults.headers.common = {
    'X-Requested-With': 'XMLHttpRequest'
};

/**
 * Handle all error messages.
 */
http.interceptors.response.use(function (response) {
    return response;
}, function (error) {
    console.log(error)
});

export default function install(Vue) {
  Object.defineProperty(Vue.prototype, '$http', {
    get() {
      return http
    },
  })
}